package IO;

import java.io.*;

public class TxtToCsv {
	
	/**turn txt to cvs
	 * */
	private void turn(){
		//char
		try {
			//BF_input(默认字符集)
			BufferedReader reader = new BufferedReader(new FileReader("message.txt"));
			//PF_写(默认字符集)
			PrintWriter writer = new PrintWriter(new FileOutputStream("ToMessage.csv"));
			String line;
			while((line=reader.readLine())!=null){
				writer.print(line.trim()+',');
				writer.print(reader.readLine().trim()+',');
				writer.println(reader.readLine().trim());
				writer.flush();
			}
			writer.close();
			reader.close();
		} catch (FileNotFoundException e) {
			e.printStackTrace();
		} catch(IOException eIO){
			eIO.printStackTrace();
		} finally{
			
		}
	}
	public static void main(String[] args) {
		new TxtToCsv().turn();
	}

}
